import {
  HomeOutlined,
  ShoppingOutlined,
  SettingOutlined,
  OrderedListOutlined,
  TagsOutlined,
  AppstoreAddOutlined,
} from '@ant-design/icons';
import { lazy } from 'react';

// 1 引入组件

// 1.2 定义routes匹配路由和呈现的组件
const routes = [
  {
    path: '/login',
    exact: true,
    component: lazy(() => import('../views/login')),
  },
  {
    path: '/',
    component: lazy(() => import('../layout/frame-layout')),
    children: [
      {
        path: '/dashboard',
        component: lazy(() => import('../views/dashboard')),
        meta: {
          title: '首页',
          icon: HomeOutlined,
        },
      },
      {
        path: '/goods',
        component: lazy(() => import('../views/goods')),
        meta: {
          title: '商品',
          icon: ShoppingOutlined,
        },
        children: [
          {
            path: '/goods/goodsList',
            component: lazy(() => import('../views/goods/goodeList')),
            exact: true,
            meta: {
              title: '商品列表',
              icon: OrderedListOutlined,
            },
          },
          {
            path: '/goods/goodclass',
            component: lazy(() => import('../views/goods/classification')),
            exact: true,
            meta: {
              title: '商品分类',
              icon: TagsOutlined,
            },
          },
          {
            path: '/goods/add',
            component: lazy(() => import('../views/goods/add/addgoods')),
            exact: true,
            meta: {
              title: '添加商品',
              icon: AppstoreAddOutlined,
              exHide: true,
            },
          },
        ],
      },
      {
        path: '/order',
        component: lazy(() => import('../views/order')),
        meta: {
          title: '订单',
          icon: ShoppingOutlined,
        },
        children: [
          {
            path: '/order/userlist',
            component: lazy(() => import('../views/order/orderlist')),
            exact: true,
            meta: {
              title: '订单列表',
              icon: OrderedListOutlined,
            },
          },
        ],
      },
      {
        path: '/user',
        component: lazy(() => import('../views/User')),
        meta: {
          title: '用户',
          icon: ShoppingOutlined,
        },
        children: [
          {
            path: '/user/userlist',
            component: lazy(() => import('../views/User/userList')),
            exact: true,
            meta: {
              title: '用户列表',
              icon: OrderedListOutlined,
            },
          },
        ],
      },
      {
        path: '/setting',
        component: lazy(() => import('../views/setting')),
        meta: {
          title: '设置',
          icon: SettingOutlined,
        },
      },
    ],
  },
]

export default routes
